﻿using System;
using System.Collections.Generic;

using Layers;

namespace HoldemGame
{
    public class Dealer
    {
        private Random rnd = new Random((int)DateTime.Now.Ticks);

        public void Shuffle(CardSet cards, int from, int to)
        {
            int j=from;
            CardSet deck = CardSet.All52;
            
            Card[] free = new Card[deck.Count];
            deck.CopyTo(free, 0, deck.Count);

            int max = free.Length-1;
            
            while (j <= to)
            {
                int index = rnd.Next(max);
                cards[j] = free[index];
                for (int i = index; i < free.Length - 1; i++)
                    free[i] = free[i + 1];
                max--;
                j++;
            }
        }
    }
}